<template>
	<view class="bg">
		<view class="top">
			<cnpTabs @changeCurrent="changeCurrent" :list="list1" itemWidth="140rpx" />
		</view>
		<view class="dybamic">
			<view class="box" v-for="(item,index) in list">
				<view class="box-l">
					<text class="text1">{{item.month}}/{{item.day}}</text>
					<text class="text2">{{item.year}}</text>
				</view>
				<view class="box-r">
					<text class="text3">{{item.title}}</text>
					<view class="centent">
						<text class="text5">{{item.content}}</text>
					</view>
					<view  v-if="!(item.video
.length==0)">
		<video class="video-box" :src="item.video"></video>
						
					</view>
					<view class="img" v-if="!(item.images.length==0)">
						<view class="img-box" v-for="(a,b) in item.images">
							<image :src="a" mode=""></image>
						</view>
					</view>
					<view class="status">
						<view class="status-l" v-if="item.status_text=='未审核'">
							<u-icon name="clock" color="#FF6C58" size="12"></u-icon>
							<text class="text4" style="color: #FF6C58;">审核中...</text>
						</view>
						<view class="status-l"  v-if="item.status_text=='审核失败'">
							<u-icon name="clock" color="#999" size="12"></u-icon>
							<text class="text4">审核失败...</text>
						</view>
						<view class="status-l"  v-if="item.status_text=='审核通过'">
							<u-icon name="clock" color="#999" size="12"></u-icon>
							<text class="text4">审核通过...</text>
						</view>
						<text class="text4" @click="arr(item.id)">删除</text>
					</view>
					
				</view>
			</view>
			
		</view>
		<!-- #ifdef MP  -->
		
		<!-- 小程序 -->

		<view v-if="show1" class="submit fixed-bottom" @click="fabu()">
				发布动态
			</view>
		<!-- #endif -->
	
		
		<u-modal :show="show" @confirm='delete1()'  @cancel='show=false' :showCancelButton='true' :content='content'></u-modal>
		
	</view>
</template>

<script>
	import cnpTabs from "../components/cnpTabs/cnpTabs.vue"
	export default {
		components: {cnpTabs},
		data() {
			return {
				show1:false,
				infos:null,
				list1: [
					{name:'全部', type:0},
					{name:'审核中', type:1},
					{name:'审核通过', type:2},
					{name:'审核失败', type:3}
				],
				list:[],
				show:false,
				title:'标题',
				content:'是否删除该动态',
				id:''
				
			}
		},
		onLoad(e) {
			this.getList(99)
			// this.infos=this.$db.get('user')
			// 	console.log('this.infos',this.infos);
			// 	console.log('this.infos.phone',this.infos.phone);
			// 	console.log('111111',(this.infos.phone==15961805133));
			// 	if(this.infos.phone==15961805133){
					
			// 	}else{
					this.show1=true
				// }
		},
		
		methods: {
			changeCurrent(e){
				/* console.log("1111",e); */
				if(e.index==1){
					this.getList(0)
				}else if(e.index==2){
					this.getList(1)
				}else if(e.index==3){
					this.getList(2)
				}else{
					this.getList(99)
				}
			},
			
			getList(status){
				this.$db.http('technician/dynamic/list',{
					status:status,
					page:1,
					limit:20
				}).then(res=>{
					this.list=res.data
					console.log(res,'**');
				})
			},
			arr(id){
				this.id=id
				this.show=true
			},
			fabu() {
			   uni.navigateTo({
			   	url:'/page-index-subcontract/release/release'
			   })
			  },
			onNavigationBarButtonTap() {
			   uni.navigateTo({
			   	url:'/page-index-subcontract/release/release'
			   })
			  },
			delete1(id){
				this.show=false
				this.$db.http('technician/dynamic/delete',{id:this.id}).then(res=>{
					uni.showToast({title:'删除成功'})
					uni.navigateBack()
				})
			}
			
		}
	}
</script>

<style lang="less" scoped>
	.video-box{
		width:  350rpx;
		height: 350rpx;
	}
	.submit {
		width: 686rpx;
		height: 96rpx;
		background: #0DA17D ;
		border-radius: 50rpx;
		font-weight: 400;
		color: #FFFFFF;
		line-height: 96rpx;
		text-align: center;
		margin: 0 auto;
		margin-bottom: 20rpx;
	}
	.bg{
		width: 100%;
		min-height: 100vh;
		background-color: #fff;
		padding-bottom: 160rpx;
	}
	.dybamic{
		width: 100%;
		padding: 30rpx;
		box-sizing: border-box;
		.box{
			width: 100%;
			min-height:200rpx;
			/* background-color: aqua; */
			display: flex;
			margin-bottom: 20rpx;
			.box-l{
				width: 15%;
				height: 100%;
				display: flex;
				flex-direction: column;
				align-items: center;
				.text1{
					font-size: 34rpx;
					font-weight: 700;
				}
				.text2{
					font-size: 24rpx;
					color: #999;
					
				}
			}
			.box-r{
				width: 80%;
				margin-left: 20rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				.text3{
					font-size: 32rpx;
					font-weight: 700;
				}
				.text5{
					font-size: 28rpx;
					color: #999;
				}
				.img{
					width: 100%;
					min-height: 100rpx;
					margin: 20rpx 0;
					display: flex;
					justify-content: flex-start;
					flex-wrap: wrap;
					
					.img-box{
						width: 30%;
						height: 150rpx;
						margin-bottom: 10rpx;
						margin-right: 10rpx;
						
						image{
							width: 100%;
							height: 100%;
						}
					}
				}
				.status{
					width: 100%;
					align-items: center;
					display: flex;
					justify-content: space-between;
					.status-l{
						display: flex;
					}
					.text4{
						font-size: 24rpx;
						color: #999;
					}
				}
			}
		}
	}
</style>